#include "Debugger.h"

Debugger::Debugger()
{
    window = new QWidget();
    window->setFixedSize(320, 240);
    window->setGeometry(250, 250, 320, 240);

    edit = new QTextEdit(window);
    edit->resize(320, 240);
    edit->setReadOnly(true);

    window->show();
    edit->show();
    edit->setFocus();
}

//Singleton - frisch entjungfert :P
Debugger* Debugger::instance = NULL;

Debugger* Debugger::getInstance()
{
    if( !instance )
        instance = new Debugger();
    return instance;
}

void Debugger::Destroy()
{
    if (instance)
    {
        delete instance;
        instance = NULL;
    }
}

Debugger::~Debugger()
{
}

void Debugger::Add(QString s)
{
    edit->setText(tr("%1%2\n").arg(edit->toPlainText()).arg(s));
}

void Debugger::Add(char s)
{
    edit->setText(tr("%1%2\n").arg(edit->toPlainText()).arg(s));
}
